import React from 'react';
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import rootRouter from './rootRouter';
import './index.less';


export default class App extends React.Component {
  render() {
    return (
      <Router>
        <div className="mian-content">
          <Switch>
            {
              rootRouter.map((item, index) => (
                <Route
                  key={index}
                  path={item.path}
                  exact={item.exact}
                  component={(props) => {
                    window.g_history = props.history;
                    return (<item.component {...props} />)
                  }}
                />)
              )
            }
            <Route component={() => '404页面'} />
          </Switch>
        </div>
      </Router>
    );
  }
}